package cn.com.huzo.repository.purchase.impl;

import cn.com.huzo.model.entities.purchase.ReportPoSurchargeEntity;
import cn.com.huzo.repository.purchase.ReportPoSurchargeRepository;
import huzofw.repository.impl.GenericRepositoryImpl;
import huzofw.repository.impl.MyBatisDaoUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Repository;

/**
 * 订单附加费一览数据访问对象。
 *
 * @author 吴旭
 */
@Repository("ReportPoSurchargeRepository")
public class ReportPoSurchargeRepositoryImpl extends GenericRepositoryImpl<ReportPoSurchargeEntity, HashMap>
        implements ReportPoSurchargeRepository {

    private final String namespace = "cn.com.huzo.repository.purchase.ReportPoSurchargeRepository";

    /**
     * 构造函数,设置the instance to ProductRepositoryImpl.class.
     */
    public ReportPoSurchargeRepositoryImpl() {
        super(ReportPoSurchargeEntity.class);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<ReportPoSurchargeEntity> fetchReportData(Map<String, Object> criterion) {
        if ("1".equals(MapUtils.getString(criterion, "Flag"))) {
            return getSqlSession().selectList(MyBatisDaoUtils.getMapperQueryId(
                    namespace, "fetchReportData01"), criterion);
        } else {
            return getSqlSession().selectList(MyBatisDaoUtils.getMapperQueryId(
                    namespace, "fetchReportData02"), criterion);
        }
    }
}
